{"ast":null,"code":"var _jsxFileName = \"/data/messenger.client/src/components/Message/index.tsx\",\n  _s = $RefreshSig$();\nimport React from 'react';\nimport classNames from \"classnames\";\nimport { MessageDate, MessageStatus, AudioMessage, Avatar, Name } from \"../index\";\nimport { getUserName } from \"../../utils/User\";\nimport { Context } from \"../../index\";\nimport { isMe, checkMimeType } from \"../../utils/Message\";\nimport reactStringReplace from 'react-string-replace';\nimport data from '@emoji-mart/data';\nimport Emoji from '@emoji-mart/react';\nimport './Message.scss';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst Message = _ref => {\n  _s();\n  var _message$bodyMessage, _message$bodyMessage2;\n  let {\n    message,\n    replyStatus = false\n  } = _ref;\n  const [isMyMessage, setIsMyMessage] = React.useState(false);\n  const {\n    store\n  } = React.useContext(Context);\n  React.useEffect(() => {\n    setIsMyMessage(isMe(message.user, store));\n  }, [message, store]);\n  return /*#__PURE__*/_jsxDEV(\"div\", {\n    className: classNames('message', {\n      'message--isme': isMyMessage && !replyStatus,\n      'message--reply': replyStatus\n    }),\n    children: /*#__PURE__*/_jsxDEV(\"div\", {\n      className: classNames('message__content', {\n        'message__content--borderLine': replyStatus\n      }),\n      children: [/*#__PURE__*/_jsxDEV(MessageStatus, {\n        replyStatus: replyStatus,\n        message: message,\n        store: store\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 29,\n        columnNumber: 17\n      }, this), !replyStatus && /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"message__avatar\",\n        children: /*#__PURE__*/_jsxDEV(Avatar, {\n          contentList: message.user.content,\n          alt: getUserName(message.user),\n          stringForFirstCharacter: getUserName(message.user),\n          stringForGenerateColor: message.user.id\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 31,\n          columnNumber: 21\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 30,\n        columnNumber: 34\n      }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"message__info\",\n        children: [replyStatus && /*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"message__reply\",\n          children: /*#__PURE__*/_jsxDEV(\"span\", {\n            children: \"\\u041F\\u0435\\u0440\\u0435\\u0441\\u043B\\u0430\\u043D\\u043D\\u043E\\u0435 \\u0441\\u043E\\u043E\\u0431\\u0449\\u0435\\u043D\\u0438\\u0435\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 41,\n            columnNumber: 29\n          }, this)\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 40,\n          columnNumber: 25\n        }, this), /*#__PURE__*/_jsxDEV(Name, {\n          user: message.user\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 44,\n          columnNumber: 21\n        }, this), (message.bodyMessage && message.bodyMessage.message && message.bodyMessage.message.length !== 0 || message.reply && message.reply.items && message.reply.items.length !== 0) && /*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"message__bubble\",\n          children: [message.bodyMessage && ((_message$bodyMessage = message.bodyMessage) === null || _message$bodyMessage === void 0 ? void 0 : _message$bodyMessage.message) && /*#__PURE__*/_jsxDEV(\"p\", {\n            className: \"message__text\",\n            children: reactStringReplace((_message$bodyMessage2 = message.bodyMessage) === null || _message$bodyMessage2 === void 0 ? void 0 : _message$bodyMessage2.message, /:(.+?):/g, (match, i) => /*#__PURE__*/_jsxDEV(Emoji, {\n              emoji: match,\n              size: 16,\n              data: data\n            }, i, false, {\n              fileName: _jsxFileName,\n              lineNumber: 54,\n              columnNumber: 41\n            }, this))\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 52,\n            columnNumber: 33\n          }, this), message.reply && message.reply.items && message.reply.items.length > 0 && message.reply.items.map(item => /*#__PURE__*/_jsxDEV(Message, {\n            message: item,\n            replyStatus: true\n          }, item.id, false, {\n            fileName: _jsxFileName,\n            lineNumber: 61,\n            columnNumber: 37\n          }, this))]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 50,\n          columnNumber: 25\n        }, this), message.bodyMessage && message.bodyMessage.content && message.bodyMessage.content.items && message.bodyMessage.content.items.length > 0 && /*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"message__attachments\",\n          children: message.bodyMessage.content.items.length !== 1 && message.bodyMessage.content.items.map(item => checkMimeType(item, 'audio') && /*#__PURE__*/_jsxDEV(AudioMessage, {\n            content: item,\n            isMe: isMyMessage,\n            replyStatus: replyStatus\n          }, item.id, false, {\n            fileName: _jsxFileName,\n            lineNumber: 74,\n            columnNumber: 53\n          }, this) || checkMimeType(item, 'image') && /*#__PURE__*/_jsxDEV(\"div\", {\n            className: \"message__attachments-item\",\n            children: /*#__PURE__*/_jsxDEV(\"img\", {\n              src: item.link,\n              alt: item.id ? item.id : 'attachments ' + item.link\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 77,\n              columnNumber: 57\n            }, this)\n          }, item.id, false, {\n            fileName: _jsxFileName,\n            lineNumber: 76,\n            columnNumber: 53\n          }, this)) || message.bodyMessage.content.items.length === 1 && message.bodyMessage.content.items.map(item => checkMimeType(item, 'audio') && /*#__PURE__*/_jsxDEV(AudioMessage, {\n            content: item,\n            isMe: isMyMessage,\n            replyStatus: replyStatus\n          }, item.id, false, {\n            fileName: _jsxFileName,\n            lineNumber: 83,\n            columnNumber: 53\n          }, this) || checkMimeType(item, 'image') && /*#__PURE__*/_jsxDEV(\"div\", {\n            className: \"message__attachments-item--onlyOneItem\",\n            children: /*#__PURE__*/_jsxDEV(\"img\", {\n              src: item.link,\n              alt: item.id ? item.id : 'attachments ' + item.link\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 86,\n              columnNumber: 57\n            }, this)\n          }, item.id, false, {\n            fileName: _jsxFileName,\n            lineNumber: 85,\n            columnNumber: 53\n          }, this))\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 69,\n          columnNumber: 37\n        }, this), /*#__PURE__*/_jsxDEV(MessageDate, {\n          message: message\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 93,\n          columnNumber: 21\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 38,\n        columnNumber: 17\n      }, this)]\n    }, void 0, true, {\n      fileName: _jsxFileName,\n      lineNumber: 27,\n      columnNumber: 13\n    }, this)\n  }, void 0, false, {\n    fileName: _jsxFileName,\n    lineNumber: 22,\n    columnNumber: 9\n  }, this);\n};\n_s(Message, \"8cwO1vRp5TivCTAPxIk+7+om2GA=\");\n_c = Message;\nexport default Message;\nvar _c;\n$RefreshReg$(_c, \"Message\");","map":{"version":3,"names":["React","classNames","MessageDate","MessageStatus","AudioMessage","Avatar","Name","getUserName","Context","isMe","checkMimeType","reactStringReplace","data","Emoji","Message","message","replyStatus","isMyMessage","setIsMyMessage","useState","store","useContext","useEffect","user","content","id","bodyMessage","length","reply","items","match","i","map","item","link"],"sources":["/data/messenger.client/src/components/Message/index.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from \"classnames\";\nimport {MessageProps} from \"../../models/props/MessageProps\";\nimport {MessageDate, MessageStatus, AudioMessage, Avatar, Name} from \"../index\";\nimport {getUserName} from \"../../utils/User\";\nimport {Context} from \"../../index\";\nimport {isMe, checkMimeType} from \"../../utils/Message\";\nimport reactStringReplace from 'react-string-replace';\nimport data from '@emoji-mart/data'\nimport Emoji from '@emoji-mart/react'\nimport './Message.scss';\n\nconst Message: React.FC<MessageProps> = ({message, replyStatus = false}) => {\n    const [isMyMessage, setIsMyMessage] = React.useState<boolean>(false);\n    const {store} = React.useContext(Context);\n\n    React.useEffect(() => {\n        setIsMyMessage(isMe(message.user, store));\n    }, [message, store]);\n\n    return (\n        <div className={classNames('message',\n            {\n                'message--isme': isMyMessage && !replyStatus,\n                'message--reply': replyStatus\n            })}>\n            <div className={classNames('message__content',\n                {'message__content--borderLine': replyStatus})}>\n                <MessageStatus replyStatus={replyStatus} message={message} store={store} />\n                {!replyStatus && <div className='message__avatar'>\n                    <Avatar\n                        contentList={message.user.content}\n                        alt={getUserName(message.user)}\n                        stringForFirstCharacter={getUserName(message.user)}\n                        stringForGenerateColor={message.user.id}\n                    />\n                </div>}\n                <div className='message__info'>\n                    {replyStatus &&\n                        <div className='message__reply'>\n                            <span>Пересланное сообщение</span>\n                        </div>\n                    }\n                    <Name user={message.user} />\n                    {\n                        ((message.bodyMessage &&\n                            message.bodyMessage.message &&\n                            message.bodyMessage.message.length !== 0) ||\n                            (message.reply && message.reply.items && message.reply.items.length !== 0)) &&\n                        <div className='message__bubble'>\n                            {message.bodyMessage && message.bodyMessage?.message &&\n                                <p className='message__text'>\n                                    {reactStringReplace(message.bodyMessage?.message, /:(.+?):/g, (match, i) => (\n                                        <Emoji key={i} emoji={match} size={16} data={data} />\n                                    ))}\n                                </p>\n                            }\n                            {\n                                message.reply && message.reply.items && message.reply.items.length > 0 &&\n                                message.reply.items.map((item)=>\n                                    <Message key={item.id} message={item} replyStatus={true} />\n                                )\n                            }\n                        </div>\n                    }\n                        {\n                            (message.bodyMessage && message.bodyMessage.content &&\n                                message.bodyMessage.content.items && message.bodyMessage.content.items.length > 0) && (\n                                    <div className='message__attachments'>\n                                        {\n                                            (message.bodyMessage.content.items.length !== 1 &&\n                                            message.bodyMessage.content.items.map((item) =>\n                                                (checkMimeType(item, 'audio') &&\n                                                    <AudioMessage content={item} isMe={isMyMessage} replyStatus={replyStatus} key={item.id}/>) ||\n                                                (checkMimeType(item, 'image') &&\n                                                    <div className='message__attachments-item' key={item.id}>\n                                                        <img src={item.link} alt={item.id ? item.id : 'attachments ' + item.link}/>\n                                                    </div>)\n                                            )) || (\n                                            message.bodyMessage.content.items.length === 1 &&\n                                            message.bodyMessage.content.items.map((item) =>\n                                                (checkMimeType(item, 'audio') &&\n                                                    <AudioMessage content={item} isMe={isMyMessage} replyStatus={replyStatus} key={item.id}/>) ||\n                                                (checkMimeType(item, 'image') &&\n                                                    <div className='message__attachments-item--onlyOneItem' key={item.id}>\n                                                        <img src={item.link} alt={item.id ? item.id : 'attachments ' + item.link}/>\n                                                    </div>)\n                                            ))\n                                        }\n                                    </div>\n                            )\n                        }\n                    <MessageDate message={message} />\n                </div>\n            </div>\n        </div>\n    );\n}\n\nexport default Message;"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAAQC,WAAW,EAAEC,aAAa,EAAEC,YAAY,EAAEC,MAAM,EAAEC,IAAI,QAAO,UAAU;AAC/E,SAAQC,WAAW,QAAO,kBAAkB;AAC5C,SAAQC,OAAO,QAAO,aAAa;AACnC,SAAQC,IAAI,EAAEC,aAAa,QAAO,qBAAqB;AACvD,OAAOC,kBAAkB,MAAM,sBAAsB;AACrD,OAAOC,IAAI,MAAM,kBAAkB;AACnC,OAAOC,KAAK,MAAM,mBAAmB;AACrC,OAAO,gBAAgB;AAAC;AAExB,MAAMC,OAA+B,GAAG,QAAoC;EAAA;EAAA;EAAA,IAAnC;IAACC,OAAO;IAAEC,WAAW,GAAG;EAAK,CAAC;EACnE,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGlB,KAAK,CAACmB,QAAQ,CAAU,KAAK,CAAC;EACpE,MAAM;IAACC;EAAK,CAAC,GAAGpB,KAAK,CAACqB,UAAU,CAACb,OAAO,CAAC;EAEzCR,KAAK,CAACsB,SAAS,CAAC,MAAM;IAClBJ,cAAc,CAACT,IAAI,CAACM,OAAO,CAACQ,IAAI,EAAEH,KAAK,CAAC,CAAC;EAC7C,CAAC,EAAE,CAACL,OAAO,EAAEK,KAAK,CAAC,CAAC;EAEpB,oBACI;IAAK,SAAS,EAAEnB,UAAU,CAAC,SAAS,EAChC;MACI,eAAe,EAAEgB,WAAW,IAAI,CAACD,WAAW;MAC5C,gBAAgB,EAAEA;IACtB,CAAC,CAAE;IAAA,uBACH;MAAK,SAAS,EAAEf,UAAU,CAAC,kBAAkB,EACzC;QAAC,8BAA8B,EAAEe;MAAW,CAAC,CAAE;MAAA,wBAC/C,QAAC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